function checkAll(form, name) {
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name.match(name)) {
			e.checked = form.elements['chkall'].checked;
		}
	}
}
$("#addbrand").dialog(
	{
		autoOpen: false,
		closeOnEscape: true,
		draggable: true,
		modal: true,
		title: '添加品牌',
		width: 600,
		buttons:{
			"提交": function(){
					$('#addbrandform').ajaxSubmit({
						dataType:'json',
						success:function(html){
							alert(html.msg);
							$("#addbrand").dialog("close");
							window.location.reload();
						}
					});
					
				    // return false to prevent normal browser submit and page navigation 
				    return false;
			},
			"取消": function() {
				$(this).dialog( "close" );
			}
		}
	}
);